<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>商户添加</title>
    <script src="https://cdn.staticfile.org/jquery/3.5.1/jquery.js" type="text/javascript"></script>
</head>
<body>
<form id="addMerchantInfo" name="addMerchantInfo" action="/merchant/addMerchantInfo">
    <table>
        <tr>
            <td>
                <label>商户名：</label>
            </td>
            <td>
                <input type="text" id="merchantName" name="merchantName" value="">
            </td>
        </tr>
        <tr>
            <td>
                <label>商户号：</label>
            </td>
            <td>
                <input type="text" id="merchantNo" name="merchantNo" value="">
            </td>
        </tr>
        <tr>
            <td>
                <label>商户类型：</label>
            </td>
            <td>
                <select name="merchantType">
                    <option value="0">请选择</option>
                    <option value="1">支付宝</option>
                    <option value="2">微信</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <label>商户所属公司：</label>
            </td>
            <td>
                <input type="text" id="merchantCompany" name="merchantCompany" value="">
            </td>
        </tr>
        <tr>
            <td>
                <label>pid：</label>
            </td>
            <td>
                <input type="text" id="merchantId" name="merchantId" value="">
            </td>
        </tr>
        <tr>
            <td>
                <label>退款类型：</label>
            </td>
            <td>
                <select name="refundType">
                    <option value="0">请选择</option>
                    <option value="1">不允许退款</option>
                    <option value="2">系统自动退款</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <label>商户私钥：</label>
            </td>
            <td>
                <textarea id="merchantPrivateKey" name="merchantPrivateKey">请在此处输入文本...</textarea>
            </td>
        </tr>
        <tr>
            <td>
                <label>商户公钥：</label>
            </td>
            <td>
                <textarea id="merchantPublicKey" name="merchantPublicKey">请在此处输入文本...</textarea>
            </td>
        </tr>
        <tr>
            <td>
                <label>商户秘钥：</label>
            </td>
            <td>
                <input type="text" id="merchantSign" name="merchantSign" value="">
            </td>
        </tr>
    </table>
    <input type="button" onclick="formSubmit()" value="提交"/>
    <input type="reset" value="重置"/>

</form>
<script type="text/javascript">
    function formSubmit() {
        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: "/merchant/addMerchantInfo",//url
            data: $('#addMerchantInfo').serialize(),
            success: function (result) {
                console.log(result);//打印服务端返回的数据(调试用)
                if (result.resultCode == 200) {
                    alert("SUCCESS");
                }
                ;
            },
            error: function () {
                alert("异常！");
            }
        });
    }
</script>
</body>
</html>